Skip to content

feat: added Regex Match config options for limit and blacklist#32

Merged
petruki merged 1 commit intomasterfrom
staging
Feb 21, 2026
Merged

feat: added Regex Match config options for limit and blacklist#32
petruki merged 1 commit intomasterfrom
staging

Conversation

@petruki
Copy link
Member

@petruki petruki commented Feb 21, 2026

This pull request adds support for configuring regex-related limits in the Switcher client, including the maximum number of blacklisted regex inputs and the regex execution time limit. These options are now available in the client context, are documented, and are covered by new tests to ensure correct behavior and performance.

Configuration and Context Initialization:

  • Added regex_max_black_list and regex_max_time_limit options to ContextOptions, with defaults set to 100 and 3000 ms respectively (switcher_client/lib/globals/global_context.py, [1] [2] [3].
  • Updated Client.build_context and related handler logic to initialize and apply these regex options on startup (switcher_client/client.py, [1] [2].

Documentation:

  • Updated the README.md to document the new options and their default values, and removed "TODO" markers (README.md, [1] [2].

Testing:

  • Added a new test case to verify that regex blacklisting and time limits work as expected, including performance checks for ReDoS inputs (tests/test_switcher_local.py, tests/test_switcher_local.pyR94-R124).
  • Refactored test helpers and existing tests to support passing the new regex options (tests/test_switcher_local.py, [1] [2].

Constants and Imports:

  • Centralized regex-related default constants and updated imports to use them consistently across the codebase (switcher_client/lib/utils/timed_match/timed_match.py, [1] tests/test_switcher_local.py, [2].

@petruki petruki self-assigned this Feb 21, 2026
@petruki petruki added the enhancement New feature or request label Feb 21, 2026
@sonarqubecloud
Copy link

@petruki petruki merged commit acd9fdc into master Feb 21, 2026
15 checks passed
@petruki petruki deleted the staging branch February 21, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant